#include<stdio.h>
int main()
{
    int two, ten=0, i=0;
	scanf("%d", &two);
	while(two)
	{
		
		int wei = two%10;
		int t = 1;   //2^t
		for(int j=0; j<=i; j++)
			t *= 2;
		ten += t*wei;
		i++;
		two /= 10;
	}
	printf("%d", ten/2);
	return 0;
}
